1. Field of the Invention
The present invention relates to a hard disk drive for executing a read or write command sent from a host, and a command execution method.
2. Related Art
In a magnetic disk device representing a hard disk device, in the reading or writing of the disk, the disk head seeks to a target track, and the disk position at the target address is moved under the head while the head positioning control is performed, waiting for the disk to be rotated in a rotational delay. The reading or writing of data on the disk is started from the time when the disk head is located at the target address. If an error occurs, a retry is performed by halting the reading or writing, waiting for the disk to be rotated once and making the reading or writing again. Since the retry is continued until the error is resolved, there occurs a rotational delay for at least one rotation of the disk until the execution of the next command is started.
The writing onto the disk needs the severe positioning control than the reading, whereby an error occurs more easily. Since there occurs a rotational delay for one or more rotations of the disk every time a write fault in which the writing on the disk fails occurs, the command execution time can be expeditious by reducing the number of write faults.
Some of the disk devices have a command queue for holding a plurality of commands. In such a disk device, the command received from the host apparatus is stored in the command queue, and the command to be executed next is selected from the commands stored in the command queue and waiting for execution and executed. Using the command queue, the reordering that is changing the order of commands to be executed differently from the issuing order of commands is allowed. The time required for executing the command can be shortened by making the reordering in consideration of the position of a command request address on the disk. For example, consider an instance where the commands are issued in the order of commands 1, 2 and 3, as shown in FIG. 14. In this instance, the reading or writing of data can be performed more efficiently by reordering and executing (disk access) the commands in the order of commands 1, 3 and 2 as shown in FIG. 14A than executing the commands in the issued order as shown in FIG. 14B. In FIGS. 14A and 14B, the areas on the disk to be read or written by the commands 1, 2 and 3 are indicated.
An STF (Shortest Time First) algorithm is one of the reordering algorithms for selecting the command having the shortest access time and performing this in repeating fashion. For example, suppose that the command 1 (the area on the disk to be read or written by the command 1 is indicated) is being executed, as shown in FIG. 15. In the STF algorithm, the command 3 is selected as the command to be executed at the next time. The command 2 passes the head position by rotation of the disk during the seek, causing an excess rotational delay for one rotation of the disk (after the end of seek, waiting for the read or write data to be located), and is not selected. After the end of executing the command 3, the command 4 is in time for the seek, whereby the command to be executed next to the command 3 is the command 4 that can be accessed most rapidly.
When the seek speed (head moving speed) is increased, the moving time between tracks is shortened. When the seek speed is not increased as shown in FIG. 16B, the command 2 cannot be selected as the next command of the command 1, but the command 3 is executed. When the seek speed is increased, the commands 1, 2 and 3 can be executed within the same period of time (FIG. 16A), whereby more commands can be executed. In this manner, if the seek speed is increased, it is possible to make more efficient reordering in accordance with the STF algorithm.
However, when the seek speed is increased, a greater vibration is passed to the head in settling the head position at the target track. As this vibration is greater, the positioning control is more difficult to cause a read/write fault more easily. Hence, if the seek speed is increased, more efficient reordering is enabled, but the write fault occurrence rate is higher, and the rotational delay time is increased, whereby the throughput is not necessarily improved.
In JP-A 6-282384 (Kokai), data that fails to write on the disk is stored in a flash memory as an alternative area of the defective sector on the disk to improve the reliability of the disk. With this method, it is expected that the throughput is improved for a random write command (write command in which the write destination address is random) having a small data size, but no process for a sequential write command (write command in which the write destination address is consecutive) or a write command having a large data size is performed in view of the improved throughput. Also, since there is no process for rewriting the data stored in the flash memory onto the disk, the process for writing the write failed data due to occurrence of the write fault into the flash memory cannot be performed when there is no available storage space of the flash memory.
In JP-A 2000-293963 (Kokai), data that fails to write on the disk is stored in a specific area on the disk. With this method, the throughput is not necessarily improved, because the rotational delay time occurs due to the seek for storing the data in the specific area.
In JP-A 2001-100935 (Kokai), data that fails to read or write on the disk is stored again in the disk command queue for reordering. With this method, the disk write for the data that causes the write fault is indispensable, whereby the penalty for write fault is not necessarily reduced. For example, after a write failure, the failed data is restored to the disk command queue, and the same command is selected as a result of reordering, as shown in FIG. 17. In this case, the operation is the same as the rewrite after waiting for one rotation of the disk, which is the process without reordering, whereby even if the process of restoring the data to the disk command queue and reordering is performed, the throughput is not improved.
In JP-A 2001-236744 (Kokai), when the reading from or writing onto the disk fails and the retry is needed, the executable command is searched in the interim. With this method, like JP-A 2001-100935 (Kokai), the writing of data causing the write fault on the disk is indispensable, whereby the penalty of write fault is not necessarily reduced.